package com.sync.utils.framework.interceptor;

import com.sync.utils.common.constant.TraceConstant;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import org.slf4j.MDC;

import java.io.IOException;

/**
 * TODO
 *
 * @Author YWF
 * @Date 2023/6/27 16:41
 */
//public class OkHttpTraceIdInterceptor implements Interceptor {
//    @Override
//    public Response intercept(Chain chain) throws IOException {
//        String traceId = MDC.get(TraceConstant.MDC_TRACE);
//        Request request = null;
//        if (traceId != null) {
//            //添加请求体
//            request = chain.request().newBuilder().addHeader(TraceConstant.MDC_TRACE, traceId).build();
//        }
//        Response originResponse = chain.proceed(request);
//
//        return originResponse;
//    }
//}
